import UIKit
import Alamofire
import GradientLoadingBar
import SwiftEventBus

class ChatMessageViewController: UITableViewController {
    let notchGradientLoadingBar = NotchGradientLoadingBar(
        height: 3.0
    )
    
    var list:[MockMessage] = []
    let cellIdentifier = "history_cell"
    
    var pageTitle = "对话记录"
    var type = 0
    override func viewDidLoad() {
        
        super.viewDidLoad()
        navigationItem.title = pageTitle
        tableView.register(HistoryCell.self, forCellReuseIdentifier: cellIdentifier)
        tableView.backgroundColor = primaryDarkBackgroundColor
        notchGradientLoadingBar.fadeIn()
//        getList()
        
       
    }
    
    
   
    
    
    override var wx_titleTextAttributes: [NSAttributedString.Key : Any]? {
           return [NSAttributedString.Key.foregroundColor: UIColor.white]
       }
    
   
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! HistoryCell
//        cell.bindViewModel(list[indexPath.row])
        return cell
    }
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }
    
    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return CGFloat(Float.random(in: 120...226))
    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        SwiftEventBus.post(EVENT_NAME_SELECT_ROLE, sender: list[indexPath.row])
        self.navigationController?.popViewController(animated: true)
    }
    
    
    
    
}
